﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Blame.Decorator;
using Blame.Entity;

namespace Blame
{
    public class Controller
    {
        DVCSDecorator mercurialDec;

        public void ConnectToRepo(string fullPath)
        {
            mercurialDec = new MercurialDecorator();
            mercurialDec.ConnectToRepo(fullPath);
        }

        public IEnumerable<User> GetUsers()
        {
            return mercurialDec.GetUsers();
        }

        public List<Changeset> GetUserLog(User user)
        {
            return mercurialDec.GetUserLog(user);
        }

        public ChurnInfo GetUserContributionByLines(User user, out int totalAddRemoveCount, out int totalAddCount, out int totalRemoveCount)
        {
            return mercurialDec.GetUserContributionByLines(user, out totalAddRemoveCount, out totalAddCount, out totalRemoveCount);
        }

        public ChurnInfo GetUserContributionByChangesets(User user, out int totalAddRemoveCount, out int totalAddCount, out int totalRemoveCount)
        {
            return mercurialDec.GetUserContributionByChangesets(user, out totalAddRemoveCount, out totalAddCount, out totalRemoveCount);
        }

        public Dictionary<User, ChurnInfo> GetChurnStatisticsByLines(out int totalAddRemoveCount, out int totalAddCount, out int totalRemoveCount)
        {
            return mercurialDec.GetChurnStatisticsByLines(out totalAddRemoveCount, out totalAddCount, out totalRemoveCount);
        }

        public Dictionary<User, ChurnInfo> GetChurnStatisticsByChangesets(out int totalAddRemoveCount, out int totalAddCount, out int totalRemoveCount)
        {
            return mercurialDec.GetChurnStatisticsByChangesets(out totalAddRemoveCount, out totalAddCount, out totalRemoveCount);
        }

        public string GenerateDiff(int revisionNumber)
        {
            return mercurialDec.GenerateDiff(revisionNumber);
        }
    }
}
